<style>
.portrait{
	width:60px;
	height:60px;
}
</style>

<div class="tool_bar">
</div>

<!--用户列表-->
<table class="grid_table order_table" *ngIf="!orderUser">
	<tr>
		<th width="80">用户头像</th>
		<th width="80">微信昵称</th>
		<th width="80">关注时间</th>
		<th width="90">订单数量</th>
		<th width="90">消费总额</th>
		<th>用户信息</th>
		<th width="70">操作</th>
	</tr>
	<tr *ngFor="let u of users">
		<td><img class="portrait" src="{{u.wx_json.headimgurl}}" alt="" /></td>
		<td>{{u.wx_json.nickname}}</td>
		<td>{{u.create_time*1000|date : "yyyy/MM/dd"}}</td>
		<td>{{u.order_info.all_num}}</td>
		<td>{{u.order_info.all_price}}</td>
		<td>
			<div>{{u.user_minor_info.name}}</div>
			<div>{{u.user_minor_info.phone}}</div>
			<div>{{u.user_minor_info.address}}</div>
		</td>
		<td><button class="grid_btn" (click)="showUserOrder(u);">详情</button></td>
	</tr>
</table>

<!--用户订单明细-->

<div *ngIf="orderUser">
	<div (click)="backToUsers();" style="cursor:pointer;line-height:1em;font-size:25px;color:#999;" class="icon_back">返回用户列表</div>
	<table class="grid_table order_table">
		<tr>
			<th width="80">用户头像</th>
			<th width="80">微信昵称</th>
			<th width="80">关注时间</th>
			<th width="90">订单数量</th>
			<th width="90">消费总额</th>
			<th>用户信息</th>
		</tr>
		<tr>
			<td><img class="portrait" src="{{orderUser.wx_json.headimgurl}}" alt="" /></td>
			<td>{{orderUser.wx_json.nickname}}</td>
			<td>{{orderUser.create_time*1000|date : "yyyy/MM/dd"}}</td>
			<td>{{orderUser.order_info.all_num}}</td>
			<td>{{orderUser.order_info.all_price}}</td>
			<td>
				<div>{{orderUser.user_minor_info.name}}</div>
				<div>{{orderUser.user_minor_info.phone}}</div>
				<div>{{orderUser.user_minor_info.address}}</div>
			</td>
		</tr>
	</table>
	<table class="grid_table order_table">
		<tr>
			<th width="100">下单时间</th>
			<th width="80">订单状态</th>
			<th width="80">支付方式</th>
			<th width="90">订单总额</th>
			<th width="70">收件人</th>
			<th width="100">电话</th>
			<th style="text-align:left;">收货地址</th>
			<th width="70">操作</th>
		</tr>
		<tbody *ngFor="let order of orders">
			<tr (click)="detailId==order.order_id?detailId=-1:detailId=order.order_id;">
				<td style="text-align:center;">{{order.create_time*1000 | date:'yyyy/MM/hh hh:mm'}}</td>
				<td>{{status[order.status]}}</td>
				<td>{{isPay[order.is_pay]}}</td>
				<td>{{order.all_price}}</td>
				<td>{{order.name}}</td>
				<td>{{order.phone}}</td>
				<td style="text-align:left;">{{order.address}}</td>
				<td><button class="grid_btn">详情</button></td>
				<div></div>
			</tr>
			<!--订单详情-->
			<tr *ngIf="order.order_id==detailId">
				<td class="order_detail" colspan="8">
					<div class="detail_table">
						<table>
							<tr>
								<th width="40">图片</th>
								<th width="150">商品名称</th>
								<th width="70">数量</th>
								<th width="70">单价</th>
								<th width="70">总价</th>
							</tr>
							<tr *ngFor="let l of order.order_list; let i = index;">
								<td><img src="{{l.img[0].img_small}}" alt="" /></td>
								<td>{{l.name}}</td>
								<td>{{l.count}}</td>
								<td>{{l.price}}</td>
								<td>{{l.all_price}}</td>
							</tr>
						</table>
					</div>
					<div class="order_operation">
						<div>订单编号 : <span>{{order.order_num}}</span></div><br />
						<div>订单备注 : <span style="color:#4DB1FE;">{{order.message}}</span></div><br />
						<div *ngIf="order.status==1">
							<button (click)="send(order);" *ngIf="order.status==1">发货</button>
							<button (click)="print(order)">打印</button>
							<button (click)="cancel(order);" *ngIf="order.status==1 || order.status==2">取消订单</button>
						</div>
					</div>
				</td>
			</tr>
		</tbody>
	</table>
</div>